/**
 *  Author:Greg Bugaj
 *  Desc:Provide some extended functionality for a String
 *  Nothing fancy but it does simplifyes working with String
 */


if(String.prototype.hashCode==null){}
	String.prototype.hashCode=function(){
		var d=this;	
		if (!d || d=="") return 1;		
		var h=0,g=0;		
		for (var i=d.length-1;i>=0;i--) {		
		  var c=parseInt(d.charCodeAt(i));		
		  h=((h << 6) & 0xfffffff) + c + (c << 14);		
		  if ((g=h & 0xfe00000)!=0) h=(h ^ (g >> 21));		
		}		
		return h;
   }




String.prototype.asciiAt=function(index)
{
	var c = this [index];
	// loop through all possible ASCII values
	var i;
	for (i = 0; i < 256; ++ i)
	{
		// convert i into a 2-digit hex string
		var h = i . toString (16);
		if (h . length == 1)
			h = "0" + h;

		// insert a % character into the string
		h = "%" + h;

		// determine the character represented by the escape code
		h = unescape (h);

		// if the characters match, we've found the ASCII value
		if (h == c)
			break;
	}
	return i;
}